import javax.jnlp.ClipboardService;
import java.io.Serializable;
import java.util.*;

public class Test {
    public boolean isSubsequence(String S, String T) {
        int lenS = S.length();
        int lenT = T.length();
        int i = 0;
        int j = 0;
        while(i <lenS && j< lenT) {
            if(S.charAt(i) == T.charAt(j)) {
                i++;
                j++;
            }else {
                j++;
            }
        }
        return i == lenS;
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<Character> list = new ArrayList<>();
        while(scanner.hasNextLine()) {
            String str = scanner.nextLine();
            Deque<Character> stack = new ArrayDeque<>();
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if(stack.isEmpty() || ch != stack.peek()) {
                    stack.push(ch);
                }else {
                    stack.pop();
                }
            }
            //栈当中的数据 就是我需要的数据 但是此时 就是逆序
            if(stack.isEmpty()) {
                System.out.println('0');
            }else {
                while(!stack.isEmpty()) {
                    list.add(stack.pop());
                }
                Collections.reverse(list);
                for (int i = 0; i < list.size(); i++) {
                    System.out.print(list.get(i));
                }
            }
        }

    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()) {
            String str = in.nextLine();
            StringBuilder stringBuilder = new StringBuilder();
            int index = -1;
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if(index == -1 || ch != stringBuilder.charAt(index)) {
                    stringBuilder.append(ch);
                    index++;
                }else {
                    stringBuilder.deleteCharAt(index);
                    index--;
                }
            }
            if(index == -1) {
                System.out.println('0');
            }else {
                System.out.println(stringBuilder);
            }
        }
    }
}
